$(document).ready(function(){
	var datetime =CurentTime();
	$(".header_right").append("<p><span>今天是"+datetime+"</span><span class='space'>|</span><a href='#'>设为首页</a></p>");
	
});

/*
$.ajax({
	type:"POST",
	url:app_path+"/MenuJsonData",
	dataType:"text",
	global: false,
	success:function(data){
		var obj = eval ("(" + data + ")");
		var htmlstr = "<ul class='nav navbar-nav'>";		
		for(var i=0;i<obj.length;i++){
			htmlstr += "<li class='dropdown'><span class='menu_space'></span><a class='dropdown-toggle' data-toggle='dropdown' role='button' aria-haspopup='true' aria-expanded='false' href='#' target='_blank'>"+obj[i].text+"</a>";
			if(obj[i].menu!=null){
				
				htmlstr +="<ul class='dropdown-menu'>";
				var menu = obj[i].menu;
				for(var j=0;j<menu.items.length;j++){
					htmlstr +="<li><a href='#'>"+menu.items[j].text+"</a></li>";
				}
				htmlstr +="</ul>";
                       
			}
			htmlstr +="</li>";		
		}
		htmlstr +="</ul>";
		$(".navcla").append(htmlstr);
	},
	error:function(){
		alert("sdfsdf");
	}
	
});

$.ajax({
	type:"POST",
	url:app_path+"/PortalJsonData",
	dataType:"text",
	global: false,
	success:function(json){
		var obj = eval (json);
		var htmlstr = "<div class='row'>";
			
			var items = obj[0].items;
			for(var j=0;j<items.length;j++){
				htmlstr +="<div class='col-sm-12 col-md-12 col-lg-3'><div class='panel panel-primary' style='height: 370px; min-width: 220px;'>";
				htmlstr +="<div class='panel-heading'><h4 class='text-center'><span class='glyphicon glyphicon-search pull-center'>&nbsp;</span>";
				htmlstr += items[j].title;
				htmlstr += "</h4></div><div class='panel-body text-center' id='left_"+j+"'>";
				//htmlstr += ""
				//htmlstr += "<iframe src='"+ items[j].autoLoad.url+"' width='100%' height='100%' scrolling='no' frameborder='0' class='portlet_iframe'></iframe>";
				htmlstr +="</div></div></div>";
				
			}
			var items1 = obj[1].items;
			for(var i=0;i<items1.length;i++){
				htmlstr +="<div class='col-sm-12 col-md-12 col-lg-9'><div class='panel panel-primary' style='height: 370px;'>";
				htmlstr +="<div class='panel-heading'><h4 class='text-center'><span class='glyphicon glyphicon-ok pull-center'>&nbsp;</span>";
				htmlstr +=items1[i].title;
				htmlstr +="</h4></div><div class='panel-body text-center' id='right_"+i+"' style='height:310px;'>";
				//htmlstr += "<iframe src='"+ items1[i].autoLoad.url+"' width='100%' height='100%' scrolling='no' frameborder='0' class='portlet_iframe'></iframe>";
				htmlstr +="</div></div></div>";
			}
			htmlstr+="</div>";
		$(".container").append(htmlstr);
		$("#left_0").load(items[0].autoLoad.url);
		$("#right_0").load(items1[0].autoLoad.url);
	},
	error:function(){
		
	}
});
*/


function CurentTime()
{ 
    var now = new Date();
   
    var year = now.getFullYear();       //年
    var month = now.getMonth() + 1;     //月
    var day = now.getDate();            //日
   
    var hh = now.getHours();            //时
    var mm = now.getMinutes();          //分
   
    var clock = year + "年";
   
    if(month < 10)
        clock += "0";
   
    clock += month + "月";
   
    if(day < 10)
        clock += "0";
       
    clock += day + "日";
    return(clock); 
} 
/** *退出** */
function logout() {
	Ext.MessageBox.confirm("确认", "您确定要退出登录吗？", function(btn) {
				if (btn == "yes") {
					Ext.Ajax.request({
								url : app.path + "/login?opr=logout",
								method : 'post',
								success : function(response) {
									if ((response.responseText) == 1) {
										window.location.href = app.path
												+ "/portlets/login.jsp";
									}
								},
								failure : function(response) {

								}
							})
				}
			})

}

/** 展开菜单* */
function showMenu() {
	if (tb != null && tb.getHeight() > 0) {
		document.getElementById("j_up").style.display = "block";
		document.getElementById("j_down").style.display = "none";
		tb.hide();

	} else if (tb != null && tb.getHeight() == 0) {
		document.getElementById("j_up").style.display = "none";
		document.getElementById("j_down").style.display = "block";
		tb.show();
	}
}
